package com.ikas.ai.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * KV模型
 *
 * @author lv.yi
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class KeyValue<K, V> implements Serializable {
    private static final long serialVersionUID = 42L;

    private K key;
    private V value;

    public static <K, V> KeyValue<K, V> empty() {
        return new KeyValue<>();
    }

    public static <K, V> KeyValue<K, V> of(K k, V v) {
        return new KeyValue<>(k, v);
    }

    @Override
    public String toString() {
        return "{\"key\": " + key + ", \"value\": " + value + "}";
    }
}
